<?php /* УТФ-8:fix */

class SPIcore__var /* extends SPI__dummy */
{
    private $verbose_values = array();

    private function get__prepare_var( & $value )
    {
        if( is_array( $value ) === true )
        {
            $keys = array_keys( $value );

            foreach( $value as & $onevalue )
            {
                $this->get__prepare_var( $onevalue );
            }
        }
        else
        {
            $value = stripslashes( $value );
        }

        return true;
    }
    
    public function get( $name, $default = false, $method = 'request' )
    {
        if( isset( $this->verbose_values[$name] ) === true )
        {
            return $this->verbose_values[$name];
        }

        if( isset( $_REQUEST[ $name ] ) === false )
        {
            return $default;
        }

        switch( $method )
        {
            default:
            case 'request': $value = $_REQUEST[ $name ]; break;
            case 'post':    $value = $_POST[ $name ];    break;
            case 'get':     $value = $_GET[ $name ];     break;
        }

        if( get_magic_quotes_gpc() )
        {
            $this->get__prepare_var( $value );
        }

        return $value;
    }

    public function get_POST( $name, $default = false )
    {
        return $this->get( $name, $default, 'post' );
    }

    public function get_GET( $name, $default = false )
    {
        return $this->get( $name, $default, 'get' );
    }

    public function set( $name, $value )
    {
        $this->verbose_values[$name] = $value;
        return true;
    }

    public function get_file( $name )
    {
        if( isset( $_FILES[$name] ) === false )
        {
            return false;
        }

        return $_FILES[$name];
    }

    public function get_files_count()
    {
        return count( $_FILES );
    }
}
